package com.yykt.weshare.config;

import com.yykt.weshare.util.RestTemplateUtils;
import lombok.Data;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Data
@Configuration
public class RestTemplateConfig {

    /**
     * 默认连接超时时间
     */
    private int defaultRestConnectTimeoutInMillis = 10000;

    /**
     * 默认read超时时间
     */
    private int defaultRestReadTimeoutInMillis = 10000;

    @Bean
    public RestTemplate restTemplate() {
        return RestTemplateUtils.getRestTemplate(
            defaultRestConnectTimeoutInMillis,
            defaultRestReadTimeoutInMillis);
    }
}
